import utility.utility
import utility.initialization
import utility.logger
import connector.linkWrapper
import downloader.downloader
import downloader.outputProcessor
import uploader.uploadWrapper
import uploader.outputProcessor
import settings
import logging


log = logging.getLogger(settings.log_name_applog)

if True:
    utility.utility.reset_all()


if True:
    utility.initialization.init()
    utility.logger.init()

if True:
    connector.linkWrapper.write_url()

if True:
    try:
        downloader.downloader.download_previous()
        downloader.downloader.download('N/A')
    except Exception, e:
        if e.message == settings.empty_file_exception:
            print "url list is empty."
    downloader.outputProcessor.processor()

if True:
    uploader.uploadWrapper.do_upload()
    #uploader.outputProcessor.processor()

log.info('program exit. \n')